#include "web/UdpSocket.h"
#include "web/Buffer.h"
#include "web/wsa.h"

int main()
{
    WSA::Init();

    auto udpSocket=std::make_shared<Web::UdpSocket>();

    int index = 0;
    while (1)
    {
        Web::SockAddrIn sockAddr;
        sockAddr.SetFamilyHostPort(AF_INET, "127.0.0.1",6655);

        Web::Buffer buffer;
        buffer.no = index++;
        int sendLen = udpSocket->SendTo<Web::Buffer>(buffer, sockAddr);

        printf("send len %d \n", sendLen);
        std::this_thread::sleep_for(std::chrono::milliseconds(500));
    }

    WSA::Clean();
    return 0;
}